package away3d.core.partition ;

import away3d.core.traverse.PartitionTraverser ;
import away3d.lights.LightBase ;

/**
 * LightNode is a space partitioning leaf node that contains a LightBase object.
 */
class LightNode extends EntityNode
{
    
    
    private var _light : LightBase ;
    
    
    
    /**
     * Creates a new LightNode object.
     * @param light The light to be contained in the node.
     */
    public function LightNode( light : LightBase )
    {
        
        super( light ) ;
        _light = light ;
        
    }
    
    
    public function light( get_light, null ) : LightBase ;
    
    
    /**
     * The light object contained in this node.
     */
    private function get_light() : LightBase
    {
        
        return _light ;
        
    }
    
    
    /**
     * @inheritDoc
     */
    override public function acceptTraverser( traverser : PartitionTraverser )
    {
        
        super.acceptTraverser( traverser ) ;
        
        if( traverser.enterNode( this ) ) 
        {
            traverser.applyLight( _light ) ;
        }
        
        traverser.leaveNode( this ) ;
        
    }
    
    
}